# Contributor: Shyam Sunder <sgsunder1@gmail.com>
# Maintainer: Shyam Sunder <sgsunder1@gmail.com>
pkgname=zfsnap
pkgver=2.0.0b3
_ver=${pkgver/b/-beta}
pkgrel=0
pkgdesc="A portable, performant script to make rolling ZFS snapshots easy"
url="https://www.zfsnap.org/"
arch="noarch !armhf !armv7" # Limited by zfs
license="BSD-3-Clause"
depends="zfs"
options="!check" # no unit tests, only consists of shell scripts
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	"
source="https://github.com/zfsnap/zfsnap/archive/v$_ver.tar.gz"
builddir="$srcdir/$pkgname-$_ver"

prepare() {
	default_prepare
	sed -i \
		-e 's#/sbin/zfs#/usr/sbin/zfs#g' \
		-e 's#/sbin/zpool#/usr/sbin/zpool#g' \
		"$builddir"/share/zfsnap/core.sh
}

package() {
	install -Dm755 "$builddir"/sbin/zfsnap.sh \
		"$pkgdir"/usr/sbin/zfsnap
	install -Dm755 "$builddir"/share/zfsnap/core.sh \
		"$pkgdir"/usr/share/zfsnap/core.sh
	install -Dm755 "$builddir"/share/zfsnap/commands/destroy.sh \
		"$pkgdir"/usr/share/zfsnap/commands/destroy.sh
	install -Dm755 "$builddir"/share/zfsnap/commands/recurseback.sh \
		"$pkgdir"/usr/share/zfsnap/commands/recurseback.sh
	install -Dm755 "$builddir"/share/zfsnap/commands/snapshot.sh \
		"$pkgdir"/usr/share/zfsnap/commands/snapshot.sh
	install -Dm644 "$builddir"/man/man8/zfsnap.8 \
		"$pkgdir"/usr/share/man/man8/zfsnap.8

	install -Dm644 "$builddir"/completion/$pkgname-completion.bash \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 "$builddir"/completion/$pkgname-completion.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
85df793abd97a3db26fcb9d779627ea295b2132dc462c3b1afc70a877d8093196992a7912957157555714c5f1e07ae1694e7fbed9ebae2482fd5f2d846eaf694  v2.0.0-beta3.tar.gz
"
